package main

import (
	"fmt"
)

func main() {
	fmt.Println("-- 数组长度 --")
	arrLength()
	fmt.Println("-- 数组遍历 --")
	showArr()
	fmt.Println("-- 数组是值类型 --")
	arrByValue()

}

func arrByValue() {
	arr := [...]string{"a", "b", "c", "d"}
	arrTwo := arr
	arrTwo[0] = "Golang"
	fmt.Println(arr)
	fmt.Println(arrTwo)
}

func showArr() {
	arr := [...]string{"Go语言基础", "Go语言入门", "Go微服务架构师"}
	for index, value := range arr {
		fmt.Printf("arr[%d] = %s\n", index, value)
	}

	for _, value := range arr {
		fmt.Printf("value = %s \n", value)
	}

	fmt.Println("showArr arr01")
	arr01 := []string{"Linux", "MySQL", "Go", "English"}
	for index, value := range arr01 {
		fmt.Printf("arr01[%d] = %s\n", index, value)
	}

	for index, value := range arr01 {
		fmt.Printf("[%d] = %s\n", index, value)
	}
}

func arrLength() {
	arr := []string{"Go语言极简一本通", "Java入门", "HTML入门到精通"}
	fmt.Println("arr数组的长度是：", len(arr))

	arr01 := []string{"Linux", "MySQL", "Go", "English"}
	fmt.Println("arr01数组的长度是：", len(arr01))
}
